-
-
Notifications
You must be signed in to change notification settings - Fork 394
[LiveComponent] Support for liveProp union type #3150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.x
Are you sure you want to change the base?
Conversation
Kocal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi and thanks for the contribution!
This new feature needs to be covered with some tests, and the CHANGELOG.md must be updated too.
Also, you only support the TypeInfo path and not the legacy PropertyInfo path, but I think that's fine.
src/LiveComponent/CHANGELOG.md
Outdated
|
|
||
| - Add support for `LiveProp` union types in Live Components. | ||
| `LiveComponentMetadataFactory` can now create `liveProp` metadata for union types. | ||
| Note: This feature only works when using a custom `hydrate` and `dehydrate` implementation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kevinmade ! Could you add a test or two covering the cases "not supposed to work" (ie: when hydrate and/or dehydrate are missing ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought a hydrator and dehydrator were required for my change, but this had something to do with my own use case, where the union had a type that wasn't a hydratable. I’ve removed the note from the changelog and added a test.
This PR adds support for liveProp union types in Live Components. Previously, using a union type would throw an exception. With this change
LiveComponentMetadataFactorywill be able to create liveProp metadata for union types, but will only work in combination with a custom hydrate and dehydrate implementation.